﻿<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>三国杀（双武将）</title>
<script type="text/javascript" src="./pages/js/common.js"></script>
<script type="text/javascript" src="./sgs/pages/js/sgs_cmd_handler.js"></script>
<script type="text/javascript">
function startGame(){
	for(var i = 0; i < 8; i++){
		var str = _('info_'+i).innerHTML;
		if(str.indexOf('还在观望') > 0 || str.indexOf('我可以了') > 0 ){
			alert('还有人在犹豫呢，再等等吧！');
			return;
		}
	}
	send('START');
}
</script>
</head>
<body>
<table width="70%"><tr><td width="100">本页操作者：</td><td id="operator" width="600">没人呢</td>
<td align="right"><input id="startBtn" type=button disabled="disabled" value="不等了开始吧" onclick="startGame();">
</td></tr></table>
<table border="0" width="100%"><tr><td width="85%">
<table  valign="center" align="center" border="1">
<tr height="200">
	<td width="33%"><div id="0"></div></td>
	<td width="33%"><div id="1"></div></td>
	<td width="33%"><div id="2"></div></td>
</tr>
<tr height="200">
	<td width="33%"><div id="7"></div></td>
	<td width="33%" align="center"><font size="8" color="blue"></td>
	<td width="33%"><div id="3"></div></td>
</tr>
<tr height="200">
	<td width="33%"><div id="6"></div></td>
	<td width="33%"><div id="5"></div></td>
	<td width="33%"><div id="4"></div></td>
</tr>
</table></td>
<td width="15%" valign="top" align="left">
    <div >聊天区:</div>
	<div id="chat_content" style="height: 200px; overflow-y: auto; border-style:solid">
            <div id="chat" style="width: 280px"></div>
            <div id="chat_end" style="height:0px; overflow:hidden"></div>
    </div>
	<br/>
	<div >
		<form>
			<input type="textarea" id="in" style="height: 20px; width: 200px"/>
			<input type="submit" value="发送" onclick="send('CHAT ' + _('in').value); _('in').value=''; return false;"/>
		</form>
	</div>
	<br/><br/>
	<div style="height:16px">Debug Cmds:</div>
	<div id="cmd" style="height: 240px; overflow-y: auto; border-style:solid">
	</div>
</td></tr></table>
<script type="text/javascript">
	var joinCmd = "\"send('JOIN ' + _('deskid_%d').value + ' ' + _('name_%d').value)\"";
	var fooStr =' \
		<div style="float:left;"> \
			<input type="hidden" id="deskid_%d" value="%d"/> \
			<input style="width:35px;background-color:#B7C0FF;" value="%d号桌" type="text" readonly="readonly"/> \
		</div>\
		<div id="info_%d" style="float: left;"> \
			<div id="signin_info_%d"> \
				尊名：<input type="text" style="width:120px;" id="name_%d"/>\
				<input type=button value="就座" onclick=' + joinCmd + ';/> \
			</div> \
		</div> \
		<div id="game_div" style="float: left; width: 280px; height: 150px; background-color:#cccccc;">\
			<div id="player_%d">                \
				<div id="message_%d"></div>     \
				<div id="equip_%d">装备:</div>  \
				<div id="judge_%d">判定:</div>  \
				<div id="card_%d">手牌:</div>   \
				<div id="cancel_%d">			\
					<input type="button" value="取消" onclick=sprintf("send(\'CANCEL %d\')", _("seatid_%d").value) disabled="disabled"/> \
				</div> 							\
				<div id="figure_%d">武将:</div>	\
				<div id="hp_%d">血量:</div>		\
				<div id="skill_%d">技能:</div>	\
			</div> 								\
		</div>';
	//alert(fooStr.replace(/%d/g, '1'));
	for(var i = 0; i < 8; i++) {
		_(""+i).innerHTML = fooStr.replace(/%d/g, ''+i);
	}
	send("INIT");
</script>
</body></html>